package cn.hx.admin.service.impl;

import cn.hx.admin.entity.JobLog;
import cn.hx.admin.dao.JobLogDao;
import cn.hx.admin.service.JobLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
 * 定时任务调度日志表(JobLog)表服务实现类
 *
 * @author makejava
 * @since 2023-12-10 20:34:21
 */
@Service("jobLogService")
public class JobLogServiceImpl implements JobLogService {
    @Resource
    private JobLogDao jobLogDao;

    /**
     * 通过ID查询单条数据
     *
     * @param jobLogId 主键
     * @return 实例对象
     */
    @Override
    public JobLog queryById(Integer jobLogId) {
        return this.jobLogDao.queryById(jobLogId);
    }

    /**
     * 分页查询
     *
     * @param jobLog 筛选条件
     * @return 查询结果
     */
    @Override
    public List<JobLog> queryByPage(JobLog jobLog) {
        return this.jobLogDao.queryAll(jobLog);
    }

    /**
     * 新增数据
     *
     * @param jobLog 实例对象
     * @return 实例对象
     */
    @Override
    public JobLog insert(JobLog jobLog) {
        this.jobLogDao.insert(jobLog);
        return jobLog;
    }

    /**
     * 修改数据
     *
     * @param jobLog 实例对象
     * @return 实例对象
     */
    @Override
    public JobLog update(JobLog jobLog) {
        this.jobLogDao.update(jobLog);
        return this.queryById(jobLog.getJobLogId());
    }

    /**
     * 通过主键删除数据
     *
     * @param jobLogId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer jobLogId) {
        return this.jobLogDao.deleteById(jobLogId) > 0;
    }
}
